package com.platform.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;


/**
 * 实体
 * 表名 nideshop_product
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2017-08-30 14:31:21
 */
public class ProductEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //主键
    private Integer id;
    //商品Id
    private Integer goodsId;
    //商品规格ids
    private String goodsSpecificationIds;
    //商品序列号
    private String goodsSn;
    //商品库存
    private Integer goodsNumber;

    //展示价格
    private BigDecimal counterPrice;
    //零售原价
    private BigDecimal unitPrice;
    
    //会员价  7.5折
    private BigDecimal retailPrice;
    //代理价  5.8折
    private BigDecimal marketPrice;
    
    //特惠价  4.5折
    private BigDecimal appExclusivePrice;
    //是否主SKU
    private Integer primaryProduct;
    
    /**
     * 翻译用字段
     */
    //商品
    private String goodsName;
    private String specificationValue;
    private UserEntity user;
    private BigDecimal salePrice;
    
    private List<GoodsSpecificationEntity> goodsSpecifications;
    
    public String getSpecificationValue() {
        return specificationValue;
    }

    public void setSpecificationValue(String specificationValue) {
        this.specificationValue = specificationValue;
    }

    /**
     * 设置：主键
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * 获取：主键
     */
    public Integer getId() {
        return id;
    }

    /**
     * 设置：商品Id
     */
    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    /**
     * 获取：商品Id
     */
    public Integer getGoodsId() {
        return goodsId;
    }

    /**
     * 设置：商品规格ids
     */
    public void setGoodsSpecificationIds(String goodsSpecificationIds) {
        this.goodsSpecificationIds = goodsSpecificationIds;
    }

    /**
     * 获取：商品规格ids
     */
    public String getGoodsSpecificationIds() {
        return goodsSpecificationIds;
    }

    /**
     * 设置：商品序列号
     */
    public void setGoodsSn(String goodsSn) {
        this.goodsSn = goodsSn;
    }

    /**
     * 获取：商品序列号
     */
    public String getGoodsSn() {
        return goodsSn;
    }

    /**
     * 设置：商品库存
     */
    public void setGoodsNumber(Integer goodsNumber) {
        this.goodsNumber = goodsNumber;
    }

    /**
     * 获取：商品库存
     */
    public Integer getGoodsNumber() {
        return goodsNumber;
    }

    /**
     * 设置：零售价格
     */
    public void setRetailPrice(BigDecimal retailPrice) {
        this.retailPrice = retailPrice;
    }

    /**
     * 获取：零售价格
     */
    public BigDecimal getRetailPrice() {
        return retailPrice;
    }

    public BigDecimal getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(BigDecimal marketPrice) {
        this.marketPrice = marketPrice;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

	public BigDecimal getCounterPrice() {
		return counterPrice;
	}

	public void setCounterPrice(BigDecimal counterPrice) {
		this.counterPrice = counterPrice;
	}

	public BigDecimal getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(BigDecimal unitPrice) {
		this.unitPrice = unitPrice;
	}

	public BigDecimal getAppExclusivePrice() {
		return appExclusivePrice;
	}

	public void setAppExclusivePrice(BigDecimal appExclusivePrice) {
		this.appExclusivePrice = appExclusivePrice;
	}

	public Integer getPrimaryProduct() {
		return primaryProduct;
	}

	public void setPrimaryProduct(Integer primaryProduct) {
		this.primaryProduct = primaryProduct;
	}

	public List<GoodsSpecificationEntity> getGoodsSpecifications() {
		return goodsSpecifications;
	}

	public void setGoodsSpecifications(List<GoodsSpecificationEntity> goodsSpecifications) {
		this.goodsSpecifications = goodsSpecifications;
	}
	
	public UserEntity getUser() {
		return user;
	}

	public void setUser(UserEntity user) {
		this.user = user;
	}

	public BigDecimal getSalePrice() {
      if(user == null) {
      	return unitPrice;
      }else {
      	switch(user.getUserLevelId()) {
	        	case 0:
	        			return unitPrice;
	        	case 1:
	        			return retailPrice;
	        	case 2:
	        			return marketPrice;
	        	case 3:
	        			return appExclusivePrice;
      		default:
      			return unitPrice;
      	}
      }
	}    
}
